scores = [90,44,55,66,15,87,15,98,65]
'''
    列表:容器
    下标，长度，切片
    len()
    循环：
        *直接遍历
        *下标遍历
    常用操作：
        添加元素：
            append 附加 在列表末尾
            insert 插入 指定下标添加元素
            extend 扩展 合并列表
        删除元素：
            remove
            del
            pop
            clear    
        修改元素：
            指定下标进行赋值
        查询：
        in
'''
print(scores[2])
print(len(scores))
print(scores[:5])
print(scores[-3:])
print(scores[::2])

sumScore = 0
for score in scores:
    sumScore += score
print(sumScore)

for i in range(0,len(scores)):
    print(i,scores[i])

scores.append(100)
print(scores)

scores.insert(0,100)
print(scores)

alist = ["a","b","c","d"]
blist = ["x","y","z"]

alist.extend(blist)
print(alist)

scores.remove(100) #根据值移除元素
print(scores)
s = scores.pop(0) #根据下标移除元素 并获取该元素 返回值
print(scores)
print(s)

del scores[0] #根据下标移除元素
print(scores)

# scores.clear()
# print(scores)

scores[3]=88
print(scores)

if 15 in scores:
    print("15在的")

print(scores.index(15))
print(scores.count(15))

#排序
scores.sort()
print(scores)
scores.sort(reverse=True)
print(scores)

allNames=[["张三","李四","王五"],["小黑","小白"],["如花","小强","鬼见愁","鬼脚七"]]
i=1
for c in allNames:
    print("第{}班有{}人分别是".format(i, len(c)))
    for s in c:
        print(s)
    i+=1

#编程实现一个元素全为数字的列表，求最大值、最小值
print(scores[0])
print(scores[-1])

scores2 = [100, 98, 8888, 686, 658, 855, 185, 145,556]
max = scores2[0]
min = scores2[0]
for s in scores2:
    if s < min:
        min = s
    if s > max:
        max = s
print(max,min)

